package com.ucode.springboot.starter.security.entity;
import org.springframework.security.core.GrantedAuthority;

/**
 * security权限封装
 */
public class UcodeGrantedAuthority implements GrantedAuthority {
	
	private static final long serialVersionUID = 1L;

	private String authority;

    public UcodeGrantedAuthority(String authority) {
        this.authority = authority;
    }

    public void setAuthority(String authority) {
        this.authority = authority;
    }

    @Override
    public String getAuthority() {
        return this.authority;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((authority == null) ? 0 : authority.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        UcodeGrantedAuthority other = (UcodeGrantedAuthority) obj;
        if (authority == null) {
            if (other.authority != null)
                return false;
        } else if (!authority.equals(other.authority))
            return false;
        return true;
    }
    
}